//
//  ZSComfortableLifeViewController.m
//  ZhuShou
//
//  Created by Dejun Liu on 15/10/28.
//  Copyright © 2015年 jw. All rights reserved.
//

#import "ZSComfortableLifeViewController.h"
#import "ZSMenuItemsView.h"
#import "ZSHome.h"
#import "ZSGroupTableView.h"
#import "ZSCTTableViewController.h"

@interface ZSComfortableLifeViewController ()

@property (nonatomic,strong) ZSMenuItemsView *menuView;
@property (nonatomic,strong) ZSGroupTableView *groupTableView;

@end

@implementation ZSComfortableLifeViewController

- (void)viewDidLoad {
    [super viewDidLoad];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)initViews
{
    [super initViews];
    self.menuView = [[ZSMenuItemsView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 40) withItems:[ZSHome df_rooms]];
    [self.view addSubview:self.menuView];
    
    //button事件
    [self.menuView setActionHandler:^(ZSMenuItemButton *button, ZSMenuItem *item){
        
    }];
    [self.menuView setSelectIndex:0];
    
    self.groupTableView = [[ZSGroupTableView alloc] initWithFrame:CGRectMake(0, self.menuView.bottom, self.view.width, self.view.height-self.menuView.bottom)];
    [self.view addSubview:self.groupTableView];
    
    for (int i=0; i<8; i++) {
        {
            ZSCTTableViewController *vc = [[ZSCTTableViewController alloc] initWithStyle:UITableViewStylePlain];
            [self addChildViewController:vc];
            [self.groupTableView addAView:vc.view];
        }
    }
    
    @weakify(self);
    [self.groupTableView setCurrentIndexChangeBlock:^(NSInteger index) {
        @strongify(self);
        [self.menuView setSelectIndex:index];
    }];
}


@end
